Compile-time optimisation of store usage in lazy functional programs

نویسنده

  • Geoff W. Hamilton
چکیده

Functional languages offer a number of advantages over their imperative counterparts. However, a substantial amount of the time spent on processing functional programs is due to the large amount of storage management which must be performed. Two apparent reasons for this are that the programmer is prevented from including explicit storage management operations in programs which have a purely functional semantics, and that more readable programs are often far from optimal in their use of storage. Correspondingly, two alternative approaches to the optimisation of store usage at compile-time are presented in this thesis. The first approach is called compile-time garbage collection. This approach involves determining at compile-time which cells are no longer required for the evaluation of a program, and making these cells available for further use. This overcomes the problem of a programmer not being able to indicate explicitly that a store cell can be made available for further use. Three different methods for performing compile-time garbage collection are presented in this thesis; compile-time garbage marking, explicit deallocation and destructive allocation. Of these three methods, it is found that destructive allocation is the only method which is of practical use. The second approach to the optimisation of store usage is called compile-time garbage avoidance. This approach involves transforming programs into semantically equivalent programs which produce less garbage at compile-time. This attempts to overcome the problem of more readable programs being far from optimal in their use of storage. In this thesis, it is shown how to guarantee that the process of compile-time garbage avoidance will terminate. Both of the described approaches to the optimisation of store usage make use of the information obtained by usage counting analysis. This involves counting the number of times each value in a program is used. In this thesis, a reference semantics is defined against which the correctness of usage counting analyses can be proved. A usage counting analysis is then defined and proved to be correct with respect to this reference semantics. The information obtained by this analysis is used to annotate programs for compile-time garbage collection, and to guide the transformation when compile-time garbage avoidance is performed. It is found that compile-time garbage avoidance produces greater increases in efficiency than compile-time garbage collection, but much of the garbage which can be collected by compile-time garbage collection cannot be avoided at compile-time. The two approaches are therefore complementary, and the expressions resulting from compile-time garbage avoidance transformations can be annotated for compile-time garbage collection to further optimise the use of storage.

برای دانلود متن کامل این مقاله و بیش از 32 میلیون مقاله دیگر ابتدا ثبت نام کنید

ثبت نام

اگر عضو سایت هستید لطفا وارد حساب کاربری خود شوید

منابع مشابه

Projection-based Termination Analysis

Termination analysis is genuinely useful for enabling optimisation in state-of-the-art compilers for lazy functional languages. Termination analysis techniques are typically restricted to determining termination in evaluation to weak head normal form; our projection-based technique gives much more detailed information, such as the fact that evaluation of an entire list or the entire spine of a ...

متن کامل

Compile-Time Garbage Collection for Lazy Functional Languages

In this paper, it is shown how information obtained by static analysis can be used to annotate lazy functional programs for compiletime garbage collection. Three different methods for compile-time garbage collection are presented; compile-time garbage marking, explicit deallocation and destructive allocation.

متن کامل

Path Semantics

Knowledge of order of evaluation of expressions is useful for compile-time optimizations for lazy sequential functional programs. We present path semantics, a non-standard semantics that describes order of evaluation for a first-order functional language with lazy evaluation. We also provide an effective abstraction of path semantics that provides compile-time information. We show how path sema...

متن کامل

A Compilation Model for Aspect-Oriented Polymorphically Typed Functional Languages

Introducing aspect orientation to a polymorphically typed functional language strengthens the importance of type-scoped advices; i.e., advices with their effects harnessed by type constraints. As types are typically treated as compile time entities, it is highly desirable to be able to perform static weaving to determine at compile time the chaining of type-scoped advices to their associated jo...

متن کامل

Annotated Threads : A Mechanism for Communicating Compile - Time Analysis Information to the Run - Time System

In order to achieve e cient execution of an algorithm on a large scale multiprocessor, a number of problems have to be addressed. Three of these problems are partitioning, placement and scheduling. In the current implementation of Alewife, these problems are handled mostly by the run-time system using Lazy Thread Creation and a Distributed-Tree Task Manager, both of which are described in this ...

متن کامل

ذخیره در منابع من


  با ذخیره ی این منبع در منابع من، دسترسی به آن را برای استفاده های بعدی آسان تر کنید

برای دانلود متن کامل این مقاله و بیش از 32 میلیون مقاله دیگر ابتدا ثبت نام کنید

ثبت نام

اگر عضو سایت هستید لطفا وارد حساب کاربری خود شوید

عنوان ژورنال:

دوره   شماره 

صفحات  -

تاریخ انتشار 1993